package com.xzy.dao;

import com.xzy.entity.Project;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component(value = "ProjectMapper")
public interface ProjectMapper {
    @Insert("insert into project(projectName,projectContent,projectTime,userId) values (#{projectName},#{projectContent},#{projectTime},#{userId})")
    void addProject(Project project);

    @Select("select * from project where projectId=#{projectId}")
    Project getProject(int projectId);

    @Select("select * from project")
    List<Project> findAll();

    @Delete("delete from project where projectId=#{projectId}")
    void deleteProject(int projectId);

    @Update("update project set projectName=#{projectName},projectContent=#{projectContent},projectTime=#{projectTime},userId=#{userId} where projectId=#{projectId}")
    void updateProject(Project project);
}
